home *** CD-ROM | disk | FTP | other *** search
- Path: server-b.cs.interbusiness.it!usenet
- From: albe@pinerolo.gvo.it (Alberto Velo)
- Newsgroups: comp.lang.c
- Subject: Watcom: pad a string ?
- Date: Thu, 01 Feb 1996 14:47:37 -0100
- Organization: Centro Servizi Interbusiness
- Message-ID: <ZCOExQTC3kJT089yn@pinerolo.gvo.it>
- Reply-To: albe@pinerolo.gvo.it
- NNTP-Posting-Host: 194.184.50.201
-
- Is there a function to pad a string with a charachter, using Watcom C/C++ 10.5
- ?
- I have an array, part of a structure (i.e. msg.from="Myname"); since array is
- of defined length in the structure ( char from[36] ), I'd need to let msg.from
- 36 chars length, padding it with spaces.
-
- Else I need to know how to write the structure to a binary file: if I use a
- sizeof(structname), while char arrays are shorter than the ones defined in the
- struct, I find additional garbage chars in the file, who fill the array sizes.
- For example, I fill msg.from with "Myname"; from is defined as 3 chars array,
- in the struct: when I write the entire struct to the file, the from field
- appears to be "Myname @ # *รจ 3 ..." , that is "Myname" + extra garbage for a
- total of 36 chars.
-
- If this can help, the structure is related to Fidonet PKTs.
- --
- Bye, AL!
-
- E-mail : albe@pinerolo.gvo.it
- Team OS/2 ITA Fidonet: 2:334/708 2:334/708.1
- OS2net : 81:439/63 81:439/63.1
-
- ***********************************************
- Pinerolo Internetworking BBS +39-121-393945
- Telnet bbs.piw.gvo.it
- ***********************************************
-